<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String filePath = basePath+"/view/rec";
%>
<!DOCTYPE html >
<html>
<head>
	<base href="<%=basePath%>">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="author" content="pixelcave">
	<meta name="robots" content="noindex, nofollow">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<title>zzblog- 发布博文</title>
	<!-- Icons -->
	<!-- The following icons can be replaced with your own, they are used by desktop and mobile browsers -->
	<link rel="shortcut icon" href="<%= filePath %>/lexyui/img/favicons/favicon.png">
	
	<link rel="icon" type="image/png" href="<%=filePath %>/lexyui/assets/img/favicons/favicon-16x16.png" sizes="16x16">
	<link rel="icon" type="image/png" href="<%=filePath %>/lexyui/assets/img/favicons/favicon-32x32.png" sizes="32x32">
	<link rel="icon" type="image/png" href="<%=filePath %>/lexyui/assets/img/favicons/favicon-96x96.png" sizes="96x96">
	<link rel="icon" type="image/png" href="<%=filePath %>/lexyui/assets/img/favicons/favicon-160x160.png" sizes="160x160">
	<link rel="icon" type="image/png" href="<%=filePath %>/lexyui/assets/img/favicons/favicon-192x192.png" sizes="192x192">
	
	<link rel="apple-touch-icon" sizes="57x57" href="<%=filePath %>/lexyui/assets/img/favicons/apple-touch-icon-57x57.png">
	<link rel="apple-touch-icon" sizes="60x60" href="<%=filePath %>/lexyui/assets/img/favicons/apple-touch-icon-60x60.png">
	<link rel="apple-touch-icon" sizes="72x72" href="<%=filePath %>/lexyui/assets/img/favicons/apple-touch-icon-72x72.png">
	<link rel="apple-touch-icon" sizes="76x76" href="<%=filePath %>/lexyui/assets/img/favicons/apple-touch-icon-76x76.png">
	<link rel="apple-touch-icon" sizes="114x114" href="<%=filePath %>/lexyui/assets/img/favicons/apple-touch-icon-114x114.png">
	<link rel="apple-touch-icon" sizes="120x120" href="<%=filePath %>/lexyui/assets/img/favicons/apple-touch-icon-120x120.png">
	<link rel="apple-touch-icon" sizes="144x144" href="<%=filePath %>/lexyui/assets/img/favicons/apple-touch-icon-144x144.png">
	<link rel="apple-touch-icon" sizes="152x152" href="<%=filePath %>/lexyui/assets/img/favicons/apple-touch-icon-152x152.png">
	<link rel="apple-touch-icon" sizes="180x180" href="<%=filePath %>/lexyui/assets/img/favicons/apple-touch-icon-180x180.png">
	<!-- END Icons -->
	
	
	<!-- Page JS Plugins CSS -->
    <link rel="stylesheet" href="<%=filePath %>/lexyui/assets/js/plugins/select2/select2.min.css">
    <link rel="stylesheet" href="<%=filePath %>/lexyui/assets/js/plugins/select2/select2-bootstrap.min.css">
    <link rel="stylesheet" href="<%=filePath %>/lexyui/assets/js/plugins/jquery-tags-input/jquery.tagsinput.min.css">
	
	<!-- Page JS Plugins CSS -->
        <link rel="stylesheet" href="<%=filePath %>/lexyui/assets/js/plugins/summernote/summernote.min.css">
        <link rel="stylesheet" href="<%=filePath %>/lexyui/assets/js/plugins/simplemde/simplemde.min.css">
	
	
	<!-- Bootstrap and OneUI CSS framework -->
	<link rel="stylesheet" href="<%=filePath %>/lexyui/assets/css/bootstrap.min.css">
	<link rel="stylesheet" id="css-main" href="<%=filePath %>/lexyui/assets/css/oneui.css">
</head>
<body>
	<div id="page-container" class="sidebar-l sidebar-mini sidebar-o side-scroll header-navbar-fixed">
            
            <!-- Sidebar -->
			<jsp:include page="rec_menu.jsp"></jsp:include>
			<!-- END Sidebar -->
			<!-- Header -->
			<jsp:include page="rec_fixed_top.jsp"></jsp:include>
			<!-- END Header -->

            <!-- Main Container -->
            <main id="main-container">
            <section class="content content-boxed">
            
				<div class="row">
					<div class="col-md-8">
						<!-- New Topic -->
                    <div class="block">
                        <div class="block-header bg-gray-lighter">
                            <h3 class="block-title"><i class="fa fa-plus"></i> 发表新文章</h3>
                        </div>
                        <div class="block-content block-content-full block-content-narrow">
                            <form class="form-horizontal  push-10-t" id="blog_content_form"  onsubmit="return false;">
                                <div class="form-group">
                                    <div class="col-md-7">
                                        <div class="form-material form-material-primary">
                                            <input class="form-control" type="text" id="blog-title" name="blog-title" placeholder="请填写主题标题...">
                                            <label for="blog-title">主题标题 <span class="text-danger">*</span></label>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-md-7">
                                        <div class="form-material form-material-primary">
                                            <input class="form-control" type="text" id="blog-desc" name="blog-desc" placeholder="请填写主题描述...">
                                            <label for="blog-desc">主题描述</label>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-md-7">
                                        <!-- Select2 (.js-select2 class is initialized in App() -> uiHelperSelect2()) -->
                                        <!-- For more info and examples you can check out https://github.com/select2/select2 -->
                                        <div class="form-material form-material-primary">
                                            <select class="js-select2 form-control" id="blog-type" name="blog-type" style="width: 100%;" data-placeholder="请选择主题类型...">
                                                <option></option>
                                                <option value="1">- 博客</option>
                                                <option value="2">- 图文</option>
                                            </select>
                                            <label for="blog-type">主题类型 <span class="text-danger">*</span></label>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-md-7">
                                        <!-- jQuery Tags Input (.js-tags-input class is initialized in App() -> uiHelperTagsInput()) -->
                                        <!-- For more info and examples you can check out https://github.com/xoxco/jQuery-Tags-Input -->
                                        <div class="form-material form-material-primary">
                                            <input class="js-tags-input form-control" type="text" id="topic-tags" name="topic-tags" value="Question">
                                            <label for="topic-tags">主题标签 <span class="text-danger">*</span></label>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-xs-12">
					                    <!-- <div class="block"> -->
			                            <div class="form-material form-material-primary">
				                            <!-- Summernote Container -->
				                            <input type="hidden" id="blog-content" name="blog-content">
				                            <div class="blog-summernote">hello zz-blog!</div>
				                        	<label for="topic-tags">主题内容</label>
					                    </div>
                                    </div>
                                </div>
                                <input type="hidden" id="blog-status" name="blog-status" />
                                <input type="hidden" id="blog-serial-id" name="blog-serial-id" value="${serialId}"/>
                            </form>
                        </div>
                    </div>
                    <!-- END New Topic -->
                    </div>
					<div class="col-md-4">
						<div class="block ">
                                <div class="block-header bg-gray-lighter">
                                    <h3 class="block-title">设置封面</h3>
                                </div>
                                <div class="block-content block-content-full block-content-narrow">
                                    <form class="form-horizontal push-10-t push-10" >
                                        <div class="form-group">
                                            <div class="col-xs-12">
                                                <div class="form-material">
                                                    <div style="height:auto;width:100%;max-height:200px;">
					                                	<img src="content/admin/timg.jpg" id="blog_img" style="width:100%;" alt=""> 
					                                </div>
                                                    <label for="thumbnail">预览</label>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-xs-12">
                                                <div class="form-material">
                                                    <input class="form-control" id="fileToUpload" type="file" name="upfile"><br>
                                                    <label for="fileToUpload">文件域</label>
                                                </div>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
					</div>
					
					<div class="col-md-4">
						<div class="block ">
                                <div class="block-header bg-gray-lighter">
                                    <h3 class="block-title">操作</h3>
                                </div>
                                <div class="block-content block-content-full block-content-narrow">
                                    <form class="form-horizontal push-10-t push-10" onsubmit="return false;" >
                                        <div class="form-group">
                                            <div class="col-xs-12">
                                                <div class="form-material">
                                                    <div class="col-sm-12">
				                                    <label class="css-input css-radio css-radio-warning push-10-r">
				                                          <input type="radio" name="push_status" value="0" checked="checked"><span></span> 公开
				                                    </label>
				                                    <label class="css-input css-radio css-radio-warning">
				                                          <input type="radio" name="push_status" value="1"><span></span> 私密(仅自己可见)
				                                    </label>
				                                </div>
                                                    <label for="push_status">发布状态</label>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
		                                    <div class="col-xs-12">
		                                        <button id="add_blog" class="btn btn-sm btn-primary" type="type"><i class="fa fa-plus"></i> 添加主题</button>
		                                        <button class="btn btn-sm btn-default" type="button"><i class="fa fa-eye"></i> 预览</button>
		                                        <button class="btn btn-sm btn-default" type="button"><i class="fa fa-floppy-o"></i> 保存至草稿箱</button>
		                                    </div>
		                                </div>
                                    </form>
                                </div>
                            </div>
					</div>
				</div>            
				</section>
				
				<!-- HIDDEN DATA -->
		        <!-- END HIDDEN DATA-->
				
            </main>
            <!-- END Main Container -->

            <!-- Footer -->
            <footer id="page-footer" class="content-mini content-mini-full font-s12 bg-gray-lighter clearfix">
                <div class="pull-right">
                    Crafted with <i class="fa fa-heart text-city"></i> by <a class="font-w600" href="####" target="_blank">zz-blog</a>
                </div>
                <div class="pull-left">
                    <a class="font-w600" href="http://goo.gl/6LF10W" target="_blank">zz-blog 3.1</a> &copy; <span class="js-year-copy"></span>
                </div>
            </footer>
            <!-- END Footer -->
        </div>
        <!-- END Page Container -->

        <!-- Apps Modal -->
        <!-- Opens from the button in the header -->
        <div class="modal fade" id="apps-modal" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-sm modal-dialog modal-dialog-top">
                <div class="modal-content">
                    <!-- Apps Block -->
                    <div class="block block-themed block-transparent">
                        <div class="block-header bg-primary-dark">
                            <ul class="block-options">
                                <li>
                                    <button data-dismiss="modal" type="button"><i class="si si-close"></i></button>
                                </li>
                            </ul>
                            <h3 class="block-title">Apps</h3>
                        </div>
                        <div class="block-content">
                            <div class="row text-center">
                                <div class="col-xs-6">
                                    <a class="block block-rounded" href="base_pages_dashboard.html">
                                        <div class="block-content text-white bg-default">
                                            <i class="si si-speedometer fa-2x"></i>
                                            <div class="font-w600 push-15-t push-15">Backend</div>
                                        </div>
                                    </a>
                                </div>
                                <div class="col-xs-6">
                                    <a class="block block-rounded" href="frontend_home.html">
                                        <div class="block-content text-white bg-modern">
                                            <i class="si si-rocket fa-2x"></i>
                                            <div class="font-w600 push-15-t push-15">Frontend</div>
                                        </div>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- END Apps Block -->
                </div>
            </div>
        </div>
        <!-- END Apps Modal -->

        <!-- OneUI Core JS: jQuery, Bootstrap, slimScroll, scrollLock, Appear, CountTo, Placeholder, Cookie and App.js -->
        <script src="<%=filePath %>/lexyui/assets/js/core/jquery.min.js"></script>
        <script src="<%=filePath %>/lexyui/assets/js/core/bootstrap.min.js"></script>
        <script src="<%=filePath %>/lexyui/assets/js/core/jquery.slimscroll.min.js"></script>
        <script src="<%=filePath %>/lexyui/assets/js/core/jquery.scrollLock.min.js"></script>
        <script src="<%=filePath %>/lexyui/assets/js/core/jquery.appear.min.js"></script>
        <script src="<%=filePath %>/lexyui/assets/js/core/jquery.countTo.min.js"></script>
        <script src="<%=filePath %>/lexyui/assets/js/core/jquery.placeholder.min.js"></script>
        <script src="<%=filePath %>/lexyui/assets/js/core/js.cookie.min.js"></script>
        <script src="<%=filePath %>/lexyui/assets/js/pub.js"></script>
        <script src="<%=filePath %>/lexyui/assets/js/app.js"></script>
        <!-- Page JS Plugins -->
        <script src="<%=filePath %>/lexyui/assets/js/plugins/select2/select2.full.min.js"></script>
        <script src="<%=filePath %>/lexyui/assets/js/plugins/jquery-tags-input/jquery.tagsinput.min.js"></script>
        <script src="<%=filePath %>/lexyui/assets/js/plugins/summernote/summernote.min.js"></script>
		<script src="<%=filePath %>/lexyui/assets/js/plugins/jquery-validation/jquery.validate.min.js"></script>
		<script src="<%=filePath %>/lexyui/assets/js/plugins/jquery-validation/additional-methods.min.js"></script>
       	
       	
       	
       	<script src="<%=filePath %>/lexyui/assets/js/pages/rec_push_blog.js"></script>
        <!-- Page JS Code -->
        <script>
            jQuery(function () {
                // Init page helpers (CKEditor + Select2 + Tags Inputs plugins)
                App.initHelpers(['select2', 'tags-inputs','summernote']);
                $("#add_blog").click(function(){
                	pushForm();
                	
                })
            });
            
            
            function pushForm(){
            	var validataFlag = $('#blog_content_form').valid();
            	if(validataFlag){
            		var shtml = $('.blog-summernote').summernote('code');
            		if(shtml==null || shtml=="" || shtml==" "){
            			alert("请输入主题内容...");
            			return;
            		}
                	//设置 主题内容
            		var arrayObj = $("#blog_content_form").serializeObject();
            		arrayObj["blog-content"]=shtml;
            		//设置 blog状态
            		//$("name=[push_status]")
            		var push_status = $("input[name='push_status']").val();
            		arrayObj["blog-status"]=push_status;
					//blog-serial-id
            		console.log(arrayObj)
            		var result = doPost("user/submitblogform", arrayObj);
            		if(result.code=="200"){
            			alert("提交成功！");
            			window.location.href="user/pushblog";
            		}
            	}
            }
            
        </script>
        
        
</body>
</html>